//
//  DetaiPageBaseModel_Ht.m
//  WZLProduct
//
//  Created by dllo on 16/3/28.
//  Copyright © 2016年 HaiTeng. All rights reserved.
//

#import "DetaiPageBaseModel_Ht.h"
#import "WHTStoryOneModel.h"
#import "WHTStoryTwoModel.h"
#import "WHTStoryThreeModel.h"
#import "WHTStoryFourModel.h"
#import "WHTStoryFiveModel.h"

@implementation DetaiPageBaseModel_Ht

- (instancetype)init{
    self = [super init];
    if (self) {
        self.dataArray_OneModel = [NSMutableArray array];
        self.dataArray_TwoModel = [NSMutableArray array];
        self.dataArray_ThreeModel = [NSMutableArray array];
        self.dataArray_FourModel = [NSMutableArray array];
        self.dataArray_FiveModel = [NSMutableArray array];
    }
    return self;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
    if ([key isEqualToString:@"data"]) {
        WHTStoryOneModel *modelOne = [[WHTStoryOneModel alloc] init];
        [modelOne setValuesForKeysWithDictionary:value];
        [self.dataArray_OneModel addObject:modelOne];
        
        for (NSDictionary *dic in value[@"spot"][@"detail_list"]) {
            WHTStoryTwoModel *modelTwo = [[WHTStoryTwoModel alloc] init];
            [modelTwo setValuesForKeysWithDictionary:dic];
            [self.dataArray_TwoModel addObject:modelTwo];

        }
        
        WHTStoryThreeModel *modelThree = [[WHTStoryThreeModel alloc] init];
        [modelThree setValuesForKeysWithDictionary:value[@"trip"]];
        [self.dataArray_ThreeModel addObject:modelThree];
 
        
        for (NSDictionary *dic in value[@"spot"][@"recommendations"]) {
            WHTStoryFourModel *modelFour = [[WHTStoryFourModel alloc] init];
            [modelFour setValuesForKeysWithDictionary:dic];
            [self.dataArray_FourModel addObject:modelFour];
   
        }
        
        for (NSDictionary *dic in value[@"spot"][@"comments"]) {
            WHTStoryFiveModel *modelFive = [[WHTStoryFiveModel alloc] init];
            [modelFive setValuesForKeysWithDictionary:dic];
            [self.dataArray_FiveModel addObject:modelFive];
            NSLog(@"%@",modelFive.name);
        }

        self.dataSource = [NSMutableArray arrayWithObjects:self.dataArray_OneModel,self.dataArray_TwoModel,self.dataArray_ThreeModel,self.dataArray_FourModel,self.dataArray_FiveModel, nil];
    }
    
    
}

@end
